Skip to content

Move structured sources handling to Build#15900

Open
bonzini wants to merge 14 commits into
mesonbuild:masterfrom
bonzini:structured-sources-no-backend
Open

Move structured sources handling to Build#15900
bonzini wants to merge 14 commits into
mesonbuild:masterfrom
bonzini:structured-sources-no-backend

Conversation

@bonzini

@bonzini bonzini commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Move the handling of structured sources from the backend to the Build object; structured sources are now lowered to GeneratedLists. This removes all the special casing of structured sources, only leaving a small lowering pass before process_compilers().

I chose to allow using structured sources for non-Rust programs. This can be done or not independent of the new implementation. If it is undesirable, I can remove it - but it's simpler to basically treat structured_sources() as syntactic sugar for generators, which they are now.

bonzini added 9 commits June 5, 2026 16:59
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Information on which generated files are handled as mere orderdeps
is split between ninjabackend and vs2010backend.  Create a single
function for that.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
List both the output (if only one) and the source.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This simplifies debugging, since all the interesting information is
added to these fields by Generator.process_files.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Prepare for adding structured_sources support to backends other
than ninja.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This is not exposed via generator.process(), but it can be used by
the conversion of StructuredSources to GeneratedLists.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Apply it to any language that does not support separate compilation.
This is still only Rust, but it provides the foundation for
transforming structured sources into normal ones.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Similar to CustomTargets, and likewise not exposed by the Meson DSL.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
@bonzini bonzini force-pushed the structured-sources-no-backend branch from 351415d to 2cc7f4a Compare June 5, 2026 15:18
@bonzini bonzini marked this pull request as ready for review June 5, 2026 16:07
@bonzini bonzini requested review from dcbaker and jpakkane as code owners June 5, 2026 16:07
bonzini added 4 commits June 5, 2026 19:00
Use GeneratedLists to copy all resources into the root
of the jar file.  No resources argument is treated simply
as an empty list.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Remove the duplicated code to find the main .rs file across
both structured and normal sources, as well as the code to
generate copy targets: instead just reuse the GeneratedList
mechanism.  This provides support across multiple backends,
makes Rust less of a special case, and in fact makes
structured sources themselves less of a special case.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
@bonzini bonzini force-pushed the structured-sources-no-backend branch from 2cc7f4a to b4334da Compare June 5, 2026 17:02
@bonzini

bonzini commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

One note: moving directly to Interpreter seems trivial/obvious, but there's a wrinkle, in that the check for mixed structured/unstructured sources (which this patch places in process_structured_sources()) must run after add_deps(). The interpreter does not see the full set of sources, only BuildTarget does.

structured_sources is not allowed in declare_dependency()'s sources
argument.  Remove it, together with all of its ramifications.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
@bonzini bonzini force-pushed the structured-sources-no-backend branch from 3302c47 to 90925a9 Compare June 8, 2026 03:15
@bonzini bonzini added this to the 1.12 milestone Jun 11, 2026
@bonzini bonzini modified the milestones: 1.12, 1.13 Jun 19, 2026
@bonzini

bonzini commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

More or less fixes #3023.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant